#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

int main()
{
    umask(0);
    //int fd = open("log.txt",O_WRONLY | O_CREAT,0666);
    //int fd = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC ,0666);
    int fd = open("log.txt",O_WRONLY | O_CREAT | O_APPEND ,0666);
    if(fd<0)
    {
        perror("open");
    }

   // const char* message = "hello bit\n";
    //const char* message = "aa";
    const char* message1 = "sdfgh";
    write(fd,message1,strlen(message1));

    close(fd);


    return 0;
}
